package com.wjf.shortlink.shortlink.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wjf.shortlink.shortlink.dao.entity.ShortLinkDAO;
import com.wjf.shortlink.shortlink.dto.biz.ShortLinkStatsRecordDTO;
import com.wjf.shortlink.shortlink.dto.req.ShortLinkBatchCreateReqDTO;
import com.wjf.shortlink.shortlink.dto.req.ShortLinkCreateReqDTO;
import com.wjf.shortlink.shortlink.dto.req.ShortLinkPageReqDTO;
import com.wjf.shortlink.shortlink.dto.req.ShortLinkUpdateReqDTO;
import com.wjf.shortlink.shortlink.dto.resp.ShortLinkBatchCreateRespDTO;
import com.wjf.shortlink.shortlink.dto.resp.ShortLinkCreateRespDTO;
import com.wjf.shortlink.shortlink.dto.resp.ShortLinkGroupCountQueryRespDTO;
import com.wjf.shortlink.shortlink.dto.resp.ShortLinkPageRespDTO;
import io.netty.handler.ipfilter.IpFilterRule;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;

import java.util.List;

//短链接接口层
public interface ShortLinkService extends IService<ShortLinkDAO> {

    //创建短链接
    ShortLinkCreateRespDTO createShortLink(ShortLinkCreateReqDTO reqDTO);

    //统计各分组中短链接数量
    List<ShortLinkGroupCountQueryRespDTO> ListGroupShortLinkCount(List<String> gIds);

    //通过分布式锁创建短链接
    ShortLinkCreateRespDTO createShortLinkByLock(ShortLinkCreateReqDTO reqDTO);

    //批量创建短链接
    ShortLinkBatchCreateRespDTO batchCreateShortLink(ShortLinkBatchCreateReqDTO reqDTO);

    //短链接跳转
    void restoreUrl(String shortUri, ServletRequest request, ServletResponse response);

    //统计短链接使用
    void shortLinkStats(ShortLinkStatsRecordDTO shortLinkStatsRecordDTO);

    //分页查询短链接
    IPage<ShortLinkPageRespDTO> pageShortLink(ShortLinkPageReqDTO reqDTO);

    //修改短链接
    void updateShortLink(ShortLinkUpdateReqDTO reqDTO);
}
